﻿using Microsoft.EntityFrameworkCore.Migrations;

namespace VisionCloud.Core.Migrations
{
    public partial class AlterTableName : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_SysDeviceUsers",
                table: "SysDeviceUsers");

            migrationBuilder.DropColumn(
                name: "IsDelete",
                table: "SysDevice");

            migrationBuilder.RenameTable(
                name: "SysDeviceUsers",
                newName: "SysDeviceUser");

            migrationBuilder.RenameIndex(
                name: "IX_SysDeviceUsers_UserGuid",
                table: "SysDeviceUser",
                newName: "IX_SysDeviceUser_UserGuid");

            migrationBuilder.RenameIndex(
                name: "IX_SysDeviceUsers_DeviceGuid",
                table: "SysDeviceUser",
                newName: "IX_SysDeviceUser_DeviceGuid");

            migrationBuilder.AlterColumn<bool>(
                name: "IsDeleted",
                table: "SysDevice",
                nullable: false,
                oldClrType: typeof(bool),
                oldType: "bool");

            migrationBuilder.AddPrimaryKey(
                name: "PK_SysDeviceUser",
                table: "SysDeviceUser",
                column: "Id");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_SysDeviceUser",
                table: "SysDeviceUser");

            migrationBuilder.RenameTable(
                name: "SysDeviceUser",
                newName: "SysDeviceUsers");

            migrationBuilder.RenameIndex(
                name: "IX_SysDeviceUser_UserGuid",
                table: "SysDeviceUsers",
                newName: "IX_SysDeviceUsers_UserGuid");

            migrationBuilder.RenameIndex(
                name: "IX_SysDeviceUser_DeviceGuid",
                table: "SysDeviceUsers",
                newName: "IX_SysDeviceUsers_DeviceGuid");

            migrationBuilder.AlterColumn<bool>(
                name: "IsDeleted",
                table: "SysDevice",
                type: "bool",
                nullable: false,
                oldClrType: typeof(bool));

            migrationBuilder.AddColumn<bool>(
                name: "IsDelete",
                table: "SysDevice",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddPrimaryKey(
                name: "PK_SysDeviceUsers",
                table: "SysDeviceUsers",
                column: "Id");
        }
    }
}
